package com.example.moban.ui.fragment;

import android.graphics.Color;
import android.os.Bundle;
import android.support.v7.view.menu.MenuAdapter;
import android.support.v7.widget.AppCompatTextView;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.alibaba.fastjson.JSON;
import com.chad.library.adapter.base.BaseQuickAdapter;

import com.example.moban.R;
import com.example.moban.api.HuRequest;
import com.example.moban.base.BaseFragment;
import com.example.moban.view.badgeview.BadgeView;
import com.rzhd.coursepatriarch.common.api.base.BaseObserver;
import com.rzhd.coursepatriarch.common.constants.HttpConstants;
import com.rzhd.coursepatriarch.common.utils.CommonUtil;
import com.rzhd.coursepatriarch.common.utils.PhoneUtils;
import com.rzhd.coursepatriarch.common.utils.ToastUtils;


import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 个人中心
 * @author huling
 * @date: 2019/2/27.
 */
public class PersonCenterFragment extends BaseFragment {

    @BindView( R.id.fragment_person_center_header_img )
    ImageView headerImg;
    @BindView( R.id.fragment_person_center_name_text )
    AppCompatTextView nameText;
    @BindView( R.id.fragment_person_center_core_text )
    AppCompatTextView scoreText;
    @BindView( R.id.fragment_person_center_coursein_text )
    AppCompatTextView courseInText;
    @BindView( R.id.fragment_person_center_duration_text )
    AppCompatTextView durationText;
    @BindView( R.id.fragment_person_center_study_star_text )
    AppCompatTextView studyStarText;

    @BindView( R.id.fragment_person_class_center_recycer_view )
    RecyclerView classCenterRecycerView;
    @BindView( R.id.fragment_person_my_service_recycer_view )
    RecyclerView myServiceRecycerView;


    @BindView( R.id.person_center_my_message_btn )
    ImageView messageBtn;

    @BindView( R.id.fragment_person_center_sign_in_btn )
    AppCompatTextView signInBtn;

    private MenuAdapter classCenterMenuAdapter;
//    private int[] classCenterMenuIconArr = {
//            R.mipmap.icon_gm , R.mipmap.icon_wdxx , R.mipmap.icon_wdsc , R.mipmap.icon_wdpl
//    };
//    private String[] classCenterMenuNameArr;
//    private List<MenuItemBean> classCenterMenuList = new ArrayList<>();
//
//    private MenuAdapter myServiceMenuAdapter;
//    private int[] myServiceMenuIconArr = {
//            R.mipmap.icon_jfsc , R.mipmap.icon_wdbb , R.mipmap.icon_bzzx , R.mipmap.icon_lxwm,
//            R.mipmap.icon_yjfk, R.mipmap.category_assistant
//    };
//    private String[] myServiceMenuNameArr;
//    private List<MenuItemBean> myServiceMenuList = new ArrayList<>();
    private HuRequest huRequest;

    /**
     * 客服电话
     */
    private String servicePhone;

    @Override
    public void setContentView(FrameLayout contentView, Bundle savedInstanceState) {
        View view = LayoutInflater.from( getContext()).inflate(R.layout.fragment_person_center_layout , null );
        contentView.addView( view );
    }

    public static PersonCenterFragment newInstance(int  type , String objectId ) {
        PersonCenterFragment f = new PersonCenterFragment();
        Bundle b = new Bundle();
        b.putInt("libType", type );
        b.putString( "objectId" , objectId  );
        f.setArguments(b);
        return f;
    }


    @Override
    public void initView(View view) {
        huRequest = new HuRequest();
//        classCenterMenuNameArr = getResources().getStringArray( R.array.person_center_one_menu_arr );
//        myServiceMenuNameArr = getResources().getStringArray( R.array.person_center_two_menu_arr );
        initMenuDatas();

    }

    @Override
    public void initData() {

    }

    private void initMenuDatas(){
//        for( int i = 0 ; i < classCenterMenuNameArr.length; i++ ){
//            MenuItemBean bean = new MenuItemBean();
//            bean.setIcon( classCenterMenuIconArr[ i ]);
//            bean.setName( classCenterMenuNameArr[ i ]);
//            classCenterMenuList.add( bean );
//        }
//        for( int i = 0 ; i < myServiceMenuNameArr.length; i++ ){
//            MenuItemBean bean = new MenuItemBean();
//            bean.setIcon( myServiceMenuIconArr[ i ]);
//            bean.setName( myServiceMenuNameArr[ i ]);
//            myServiceMenuList.add( bean );
//        }
    }


    @Override
    public void onClick(View view) {

    }
}